package com.xhwl.logistics.controller;


import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.query.cent.vehicle.CardChargeRuleQuery;
import com.xhwl.common.query.cent.vehicle.CardQuery;
import com.xhwl.common.vo.cent.vehicle.CardChargeRuleVO;
import com.xhwl.logistics.service.IVehcCardChargeRuleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lu.Aaron
 * @since 2021-07-07
 * @menu 卡类型管理
 */
//@RestController
@Api("收费")
@RequestMapping("/charge-rule")
public class VehcCardChargeRuleController {
    @Autowired
    private IVehcCardChargeRuleService vehcCardChargeRuleService;
    /**
     * 新增卡类型
     * @param cardChargeRuleVO
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultJson add(@RequestBody @Validated CardChargeRuleVO cardChargeRuleVO) {

        return  vehcCardChargeRuleService.add(cardChargeRuleVO);
    }


    /**
     * 修改卡类型
     * @param cardChargeRuleVO
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public ResultJson update(@RequestBody @Validated CardChargeRuleVO cardChargeRuleVO) {

        return  vehcCardChargeRuleService.edit(cardChargeRuleVO);
    }

    /**
     * 删除卡类型
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public ResultJson delete( @RequestParam(value = "id") Integer id) {

        return  vehcCardChargeRuleService.delete(id);
    }

    /**
     * 分页
     * @param cardChargeRuleQuery
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/page/test", method = RequestMethod.POST)
    public ResultJson cardChargeRulePage(@RequestBody CardChargeRuleQuery cardChargeRuleQuery) {
        return  vehcCardChargeRuleService.cardChargeRulePage(cardChargeRuleQuery);
    }

    /**
     * 列表
     * @param cardChargeRuleQuery
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/list/test", method = RequestMethod.POST)
    public ResultJson list(@RequestBody CardChargeRuleQuery cardChargeRuleQuery) {
        return  vehcCardChargeRuleService.list(cardChargeRuleQuery);
    }

    /**
     * 收费方式
     * @param industryId
     * @param cardQuery
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/charge-way", method = RequestMethod.POST)
    public ResultJson chargeWay(@RequestHeader Short industryId, @RequestBody CardQuery cardQuery) {
        return  vehcCardChargeRuleService.chargeWay(industryId,cardQuery);
    }

    /**
     * 收费套餐（app）
     * @param cardChargeRuleQuery
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/fee-service-list", method = RequestMethod.POST)
    public ResultJson feeServiceList(@RequestBody CardChargeRuleQuery cardChargeRuleQuery) {
        return  vehcCardChargeRuleService.feeServiceList(cardChargeRuleQuery);
    }


}

